<script>
export default {
  name: 'InterviewListItem',
  props:{
    obj:{
      type: Object,
      default: () => {
        return {}
      }
    }
  }
}
</script>

<template>
<div class="list-item" @click="$emit('onClickItem')">
  <div class="header">
    <div class="avatar">
      <img :src="obj.avatar" alt="">
    </div>
    <div class="info">
      <div class="title">{{ obj.stem }}</div>
      <div class="bottom">
        <span class="name">{{ obj.creator }}</span>
        <span class="name"> | </span>
        <span class="time">{{ obj.createdAt }}</span>
      </div>
    </div>
  </div>
  <div class="content" v-html="obj.content">
  </div>
  <div class="tag">
    <span class="like">点赞 {{ obj.likeCount }}</span>
    <span> | </span>
    <span class="view">浏览 {{ obj.views }}</span>
  </div>
  <div class="footer">
    <slot></slot>
  </div>
</div>
</template>

<style scoped lang="less">
  .list-item{
    padding: 10px;
    .header{
      display: flex;
      height: 40px;
      padding: 0 10px;
      align-items: center;
      .avatar{
        margin-right: 10px;
        img{
          width: 40px;
          height: 40px;
          border-radius: 50%;
        }
      }
      .info{
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        flex: 1;
        .title{
          font-size: 14px;
        }
        .bottom{
          font-size: 10px;
          color: #999999;
        }
      }
    }
    .content{
      margin: 10px 0;
      padding: 0 10px;
      font-size: 14px;
      line-height: 1.6;
      color: #666666;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }
    .tag{
      height: 20px;
      line-height: 20px;
      padding: 0 10px;
      font-size: 12px;
      color: #999999;
      //font-weight: 500;
    }
  }
</style>